@extends('layouts.app') @section('content')
<div class="container">
	<div class="row">
		<div class="col-md-10 col-md-offset-1">
			<div class="panel panel-default">
				<div class="panel-heading">阅读榜</div>
				<div class="panel-body">
					@if (count($errors) > 0)
					<div class="alert alert-danger">
						{!! implode('
						<br>', $errors->all()) !!}
					</div>
					@endif

					<table class="table">
						<thead>
							<tr>
								<th>阅读数</th>
								<th>标题</th>
								<th>作者</th>
								<th>内容</th>
								<th>创建日期</th>
								<th>点赞数</th>
								<th>评论数</th>
							</tr>
						</thead>

						<tbody>

							@foreach ($articles as $article)
							<tr>
								<td>{{ $article->read_total }}</td>
								<td>{{ mb_substr($article->title,0,10) }}</td>
								@foreach ($article->hasManyUsers as $user)
								<td>{{ $user->name }}</td>
								@endforeach
								<td>{{ mb_substr($article->body,0,16).'...' }}</td>
								<td>{{ $article->created_at }}</td>
								<td>{{ $article->upvote_total }}</td>
								<td>{{ $article->reply_total }}</td>
							</tr>
							@endforeach

						</tbody>
					</table>

				</div>